source("/home/jc227089/evo-dispersal/KBGrad/KBGradfunctions.R")
setwd("/home/jc227089/SRE/KB/DispOnly/limits/figures/")


stable.domain<-50
K<-50
lmda<-10
b<-1
n<-2*stable.domain*K
spX<-stable.domain
ngens<-100
Hmean<-0
Dmean<-0
h2H<-0
h2D<-0.5
VPH<-0.25
VPD<-0.05

	
pop<-init.inds(n=n, spX=spX, Hmean=Hmean, Dmean=Dmean,
	h2H=h2H, h2D=h2D, VPH=VPH, VPD=VPD)
ztrace<-c()
  for(ii in 1:ngens){
    pop<-repro.disp(popmatrix=pop, K=K, lambda=lmda, b=b, 
    	h2H=h2H, h2D=h2D, VPH=VPH, VPD=VPD, evovar=TRUE, stable.domain=stable.domain)
    if (is.null(pop)) break
    #plotter.mean(popmatrix=pop, K=K, lambda=lmda, b=b, stable.domain=stable.domain, bw=1, filename=paste("../figures/pop", sprintf("%04d", ii), ".pdf", sep=""))
	if (ii>50){
		ztrace<-rbind(ztrace, dzdx3(pop, K, lmda, b, stable.domain=stable.domain, ii))
	}
}
  
  	
	


  	



	

